package com.meterreadingsys.broadCast;


import com.meterreadingsys.activity.MainActivity;


import android.R;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class OpenGpsBroadCast extends BroadcastReceiver{

	@Override
	public void onReceive(Context context, Intent intent) {

		NotificationManager manager = (NotificationManager)context  
		        .getSystemService(Context.NOTIFICATION_SERVICE);  
		        // 创建一个Notification  
		        Notification notification = new Notification();  
		        // 设置显示在手机最上边的状态栏的图标  
		        notification.icon = R.drawable.ic_menu_help;  
		        // 当当前的notification被放到状态栏上的时候，提示内容  
		        notification.tickerText = "注意了，请打开GPS";  
		     // 添加声音提示  
		        notification.defaults |=Notification.DEFAULT_SOUND;  
		        // audioStreamType的值必须AudioManager中的值，代表着响铃的模式  
		        notification.audioStreamType= android.media.AudioManager.ADJUST_LOWER;  
		        Intent intents = new Intent(context, MainActivity.class);  
		        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intents, PendingIntent.FLAG_ONE_SHOT);  
		        notification.setLatestEventInfo(context, "内容提示：", "我就是一个测试文件", pendingIntent);  
		        manager.notify(1, notification); 
		
	}
    
}
